Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 6 pull requests #137241

Closed
wants to merge 25 commits into from

Conversation

matthiaskrgr
Copy link
Member

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

elichai and others added 25 commits October 28, 2024 17:28
Const-stabilizes `slice::as_flattened{,_mut}`:
```rust
// core::slice
impl<T, const N: usize> [[T; N]] {
    pub const fn as_flattened(&self) -> &[T];
    pub const fn as_flattened_mut(&mut self) -> &mut [T];
}
```

Tracking issue: rust-lang#95629

Requires separate libs-api FCP, as per rust-lang#95629 (comment).

Closes rust-lang#95629.
…l` field in `LayoutData`.

Also update comments that refered to BackendRepr::Uninhabited.
Add codegen test for uninhabited PassMode::Indirect return types.
* Order IDEs alphabetically so that manually searching for an IDE
  is easier, both when running `./x setup` and when editing the
  source code behind `./x setup`
* Prepare for IDEs with spaces in their names
* Allow explicitly typing 'none' for the IDE
* Change capitalization of `Vscode` to the more standard `VsCode`
* Make minor efficiency improvements
* Add `'static` annotations where they apply
* Order items as the average of the two adaptors. Enables easier diffs.
* Consistently apply #[inline].
* Implement FromInner<Vec<u8>> for bytes::Buf.
* Implement Clone::clone_from for wtf8::Buf.
Co-authored-by: Jubilee <workingjubilee@gmail.com>
Added project-specific Zed IDE settings

This repository currently has project-specific VS Code IDE settings in `.vscode` and `compiler/rustc_codegen_cranelift/.vscode`. Now there are equivalent project-specific Zed IDE settings alongside those.

This fixes `rust-analyzer` not being able to properly handle this project.

Note that:

1. The contents of `src/tools/rust-analyzer/.vscode` could not be translated to Zed, as they aren't basic IDE settings.
2. One of the VS Code settings in `.vscode` has no corresponding setting in Zed, and so this has been noted like this:

    ```json
      "_settings_only_in_vs_code_not_yet_in_zed": {
        "git.detectSubmodulesLimit": 20
      },
    ```
…nieu

Impl TryFrom<Vec<u8>> for String

I think this is useful enough to have :)
As a general question, is there any policy around adding "missing" trait implementations? (like adding `AsRef<T> for T` for std types), I mostly stumble upon them when using a lot of "impl Trait in argument position" like (`foo: impl Into<String>`)
…en, r=Amanieu

Stabilize const_slice_flatten

Const-stabilizes `slice::as_flattened{,_mut}`:
```rust
// core::slice
impl<T, const N: usize> [[T; N]] {
    pub const fn as_flattened(&self) -> &[T];
    pub const fn as_flattened_mut(&mut self) -> &mut [T];
}
```

Tracking issue: rust-lang#95629

Requires separate FCP, as per rust-lang#95629 (comment).

Closes rust-lang#95629.

````@rustbot```` modify labels: +T-libs-api

Happy new year!
…bited, r=workingjubilee

Do not ignore uninhabited types for function-call ABI purposes. (Remove BackendRepr::Uninhabited)

Accepted MCP: rust-lang/compiler-team#832

Fixes rust-lang#135802

Do not consider the inhabitedness of a type for function call ABI purposes.

* Remove the [`rustc_abi::BackendRepr::Uninhabited`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_abi/enum.BackendRepr.html) variant
  * Instead calculate the `BackendRepr` of uninhabited types "normally" (as though they were not uninhabited "at the top level", but still considering inhabitedness of variants to determine enum layout, etc)
* Add an `uninhabited: bool` field to [`rustc_abi::LayoutData`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_abi/struct.LayoutData.html) so inhabitedness of a `LayoutData` can still be queried when necessary (e.g. when determining if an enum variant needs a tag value allocated to it).

This should not affect type layouts (size/align/field offset); this should only affect function call ABI, and only of uninhabited types.

cc ``@RalfJung``
…Denton

Organize `OsString`/`OsStr` shims

Synchronize the `bytes.rs` and `wtf8.rs` shims for `OsString`/`OsStr` so they're easier to diff between each other. This is mostly ordering items the same between the two. I tried to minimize moves and went for the average locations between the files.

With them in the same order, it is clear that `FromInner<_>` is not implemented for `bytes::Buf` and `Clone::clone_from` is not implemented for `wtf8::Buf`, but they are for the other. Fix that.

I added #[inline] to all inherent methods of the `OsString`/`OsStr` shims, because it seemed that was already the rough pattern. `bytes.rs` has more inlining than `wtf8.rs`, so I added the corresponding ones to `wtf8.rs`. Then, the common missing ones have no discernible pattern to me. They're not divided by non-allocating/allocating. Perhaps the pattern is that UTF-8 validation isn't inlined? Since these types are merely the inner values in `OsStr`/`OsString`, I put inline on all methods and let those public types dictate inlining. I have not inspected codegen or run benchmarks.

Also, touch up some (private) documentation comments.

r? ````@ChrisDenton````
…er-errors

docs(dev): Update the feature-gate instructions

`features_untracked` was removed in rust-lang#114723

features are now functions as of  rust-lang#132027
@rustbot rustbot added A-rustc-dev-guide Area: rustc-dev-guide S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Feb 18, 2025
@rustbot rustbot added the rollup A PR which is a rollup label Feb 18, 2025
@matthiaskrgr
Copy link
Member Author

@bors r+ rollup=never p=5

@bors
Copy link
Contributor

bors commented Feb 18, 2025

📌 Commit 29c6ae0 has been approved by matthiaskrgr

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 18, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 19, 2025
…iaskrgr

Rollup of 6 pull requests

Successful merges:

 - rust-lang#127793 (Added project-specific Zed IDE settings)
 - rust-lang#132268 (Impl TryFrom<Vec<u8>> for String)
 - rust-lang#134995 (Stabilize const_slice_flatten)
 - rust-lang#136985 (Do not ignore uninhabited types for function-call ABI purposes. (Remove BackendRepr::Uninhabited))
 - rust-lang#137155 (Organize `OsString`/`OsStr` shims)
 - rust-lang#137227 (docs(dev): Update the feature-gate instructions)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Contributor

bors commented Feb 19, 2025

⌛ Testing commit 29c6ae0 with merge 6db6745...

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-nopt failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
failures:

---- [codegen] tests/codegen/uninhabited-transparent-return-abi.rs stdout ----

error: verification with 'FileCheck' failed
status: exit status: 1
command: "/checkout/obj/build/x86_64-unknown-linux-gnu/ci-llvm/bin/FileCheck" "--input-file" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/uninhabited-transparent-return-abi/uninhabited-transparent-return-abi.ll" "/checkout/tests/codegen/uninhabited-transparent-return-abi.rs" "--check-prefix=CHECK" "--allow-unused-prefixes" "--dump-input-context" "100"
--- stderr -------------------------------
/checkout/tests/codegen/uninhabited-transparent-return-abi.rs:24:17: error: CHECK-NEXT: expected string not found in input
/checkout/tests/codegen/uninhabited-transparent-return-abi.rs:24:17: error: CHECK-NEXT: expected string not found in input
 // CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %_1)
                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/uninhabited-transparent-return-abi/uninhabited-transparent-return-abi.ll:9:33: note: scanning from here
 %_1 = alloca [24 x i8], align 8
                                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/uninhabited-transparent-return-abi/uninhabited-transparent-return-abi.ll:10:2: note: possible intended match here
 call void @opaque(ptr sret([24 x i8]) align 8 %_1) #2
/checkout/tests/codegen/uninhabited-transparent-return-abi.rs:36:17: error: CHECK-NEXT: expected string not found in input
/checkout/tests/codegen/uninhabited-transparent-return-abi.rs:36:17: error: CHECK-NEXT: expected string not found in input
 // CHECK-NEXT: call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %_2)
                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/uninhabited-transparent-return-abi/uninhabited-transparent-return-abi.ll:17:33: note: scanning from here
 %_2 = alloca [24 x i8], align 8
                                ^
/checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/uninhabited-transparent-return-abi/uninhabited-transparent-return-abi.ll:18:2: note: possible intended match here
 call void @opaque_with_arg(ptr sret([24 x i8]) align 8 %_2, i32 %rsi) #2

Input file: /checkout/obj/build/x86_64-unknown-linux-gnu/test/codegen/uninhabited-transparent-return-abi/uninhabited-transparent-return-abi.ll
Check file: /checkout/tests/codegen/uninhabited-transparent-return-abi.rs


-dump-input=help explains the following input dump.
Input was:
<<<<<<
<<<<<<
           1: ; ModuleID = 'uninhabited_transparent_return_abi.a7057bcf2427c7c1-cgu.0' 
           2: source_filename = "uninhabited_transparent_return_abi.a7057bcf2427c7c1-cgu.0" 
           3: target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" 
           5:  
           5:  
           6: ; Function Attrs: nonlazybind uwtable 
           7: define void @test_uninhabited_ret_by_ref() unnamed_addr #0 { 
           9:  %_1 = alloca [24 x i8], align 8 
           9:  %_1 = alloca [24 x i8], align 8 
next:24'0                                     X error: no match found
          10:  call void @opaque(ptr sret([24 x i8]) align 8 %_1) #2 
next:24'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
next:24'1      ?                                                      possible intended match
          11:  unreachable 
next:24'0     ~~~~~~~~~~~~~
          12: } 
next:24'0     ~~
next:24'0     ~
next:24'0     ~
          14: ; Function Attrs: nonlazybind uwtable 
next:24'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          15: define void @test_uninhabited_ret_by_ref_with_arg(i32 %rsi) unnamed_addr #0 { 
next:24'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          17:  %_2 = alloca [24 x i8], align 8 
          17:  %_2 = alloca [24 x i8], align 8 
next:36'0                                     X error: no match found
          18:  call void @opaque_with_arg(ptr sret([24 x i8]) align 8 %_2, i32 %rsi) #2 
next:36'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
next:36'1      ?                                                                         possible intended match
          19:  unreachable 
next:36'0     ~~~~~~~~~~~~~
          20: } 
next:36'0     ~~
next:36'0     ~
next:36'0     ~
          22: ; Function Attrs: noreturn nonlazybind uwtable 
next:36'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          23: declare void @opaque(ptr sret([24 x i8]) align 8) unnamed_addr #1 
next:36'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
next:36'0     ~
next:36'0     ~
          25: ; Function Attrs: noreturn nonlazybind uwtable 
next:36'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          26: declare void @opaque_with_arg(ptr sret([24 x i8]) align 8, i32) unnamed_addr #1 
next:36'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
next:36'0     ~
next:36'0     ~
          28: attributes #0 = { nonlazybind uwtable "probe-stack"="inline-asm" "target-cpu"="x86-64" } 
next:36'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          29: attributes #1 = { noreturn nonlazybind uwtable "probe-stack"="inline-asm" "target-cpu"="x86-64" } 
next:36'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          30: attributes #2 = { noreturn } 
next:36'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
next:36'0     ~
next:36'0     ~
          32: !llvm.module.flags = !{!0, !1} 
next:36'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          33: !llvm.ident = !{!2} 
next:36'0     ~~~~~~~~~~~~~~~~~~~~
next:36'0     ~
next:36'0     ~
          35: !0 = !{i32 8, !"PIC Level", i32 2} 
next:36'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          36: !1 = !{i32 2, !"RtLibUseGOT", i32 1} 
next:36'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          37: !2 = !{!"rustc version 1.87.0-nightly (6db6745d0 2025-02-19)"} 
next:36'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
------------------------------------------



@bors
Copy link
Contributor

bors commented Feb 19, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rustc-dev-guide Area: rustc-dev-guide rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.